package 多线程案例;
//单例模型
//期望进程中只能有一个实例
//饥汉模式：类一加载就会创建出所有的
class Singleton{
    private static Singleton singleton = new Singleton();

    public static Singleton getSingleton(){
        return singleton;
    }

    //核心操作
    private Singleton(){}

}
public class Demo_1 {
    public static void main(String[] args) {
//        Singleton singleton = new Singleton();
        Singleton s1 = Singleton.getSingleton();
        Singleton s2 = Singleton.getSingleton();
        System.out.println(s1 == s2);

    }
}
